package com.itcam.phaseiii.lambda_.test;

/**
 * Author:Cammy.Wu
 * Date:2024-04-29
 * Description:
 */

public class LambdaTest4 {
    public static void main(String[] args) {
        useCalculator(new Calcuator() {
            @Override
            public int calc(int a, int b) {
                return a + b;
            }
        });

        System.out.println("-------------------------------------------");

        useCalculator((int a, int b) -> a - b
        );
    }

    public static void useCalculator(Calcuator calcuator) {
        int result = calcuator.calc(7, 5);
        System.out.println(result);
    }
}

interface Calcuator {
    int calc(int a, int b);
}
